package de.szut.scene.helper;

import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.util.adt.pool.GenericPool;

/**
 * Created with IntelliJ IDEA.
 * User: nbothmer
 * Date: 16.10.13
 * Time: 13:47
 * To change this template use File | Settings | File Templates.
 */
public class InfectedDotPool extends GenericPool<Sprite> {

    private VertexBufferObjectManager vbom;
    private ITextureRegion texture;

    public InfectedDotPool(ITextureRegion textureRegion,VertexBufferObjectManager vbom){
        this.vbom = vbom;
        this.texture = textureRegion;

    }

    @Override
    protected Sprite onAllocatePoolItem() {
        return new Sprite(0,0,texture,vbom);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected void onHandleRecycleItem(Sprite pItem) {
        pItem.setIgnoreUpdate(true);
        pItem.setVisible(false);
    }

    @Override
    protected void onHandleObtainItem(Sprite pItem) {
        pItem.reset();
    }
}
